using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using NUnit.Framework;
using SCSFContrib.CompositeUI.WPF.Visualizer;
using SCSFContrib.CompositeUI.WPF.Workspaces;

namespace SCSFContrib.CompositeUI.WPF.UnitTest.Visualizer
{
	[TestFixture]
	public sealed class VisualizerWindowTest : UnitTest
	{
		private VisualizerWindow _visualizerWindow;

		[Test]
		public void Constructor_ShouldSetUpTabWorkspace()
		{
			ExecuteInSeparateAppDomain("Constructor_ShouldSetUpTabWorkspace_DoWork");
		}

		private void Constructor_ShouldSetUpTabWorkspace_DoWork()
		{
			Application application = new Application();
			_visualizerWindow = new VisualizerWindow();
			Assert.IsTrue(_visualizerWindow.Content is TabWorkspace);
		}

		[Test]
		public void OnClosing_ShouldMinimizeInsteadOfClose()
		{
			ExecuteInSeparateAppDomain("OnClosing_ShouldMinimizeInsteadOfClose_DoWork");
		}

		private void OnClosing_ShouldMinimizeInsteadOfClose_DoWork()
		{
			Application application = new Application();
			_visualizerWindow = new VisualizerWindow();
			_visualizerWindow.Width = 0;
			_visualizerWindow.Height = 0;
			_visualizerWindow.WindowStyle = System.Windows.WindowStyle.None;
			_visualizerWindow.ShowInTaskbar = false;
			_visualizerWindow.Show();
			Assert.AreEqual(WindowState.Normal, _visualizerWindow.WindowState);
			_visualizerWindow.Close();
			Assert.IsTrue(_visualizerWindow.IsVisible);
			Assert.AreEqual(WindowState.Minimized, _visualizerWindow.WindowState);
		}
	}
}
